<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"
	xmlns:t="https://code.google.com/p/rad-framework/taglib"
	xmlns:tt="https://code.google.com/p/rad-framework"
	xmlns:s="http://jboss.com/products/seam/taglib" template="#{theme.entity}">
	
	<ui:define name="edit-view-action">
		<tt:link id="editLink"
			path="#{tree.master.viewPath}"
			entityName="#{currentTree.type}"
			key="#{currentTree.key}"
			mode="Edit"
			rendered="#{currentTree.editor.renderEdit}"
			styleClass="rad-framework-action-panel">
			<h:outputText styleClass="rad-framework-action-edit" value="#{messages['Edit']}" />
			<s:conversationId/>
		</tt:link>
	</ui:define>
	
	<ui:define name="main">
		<h:panelGrid columns="1" cellspacing="4" width="100%">
			<ui:include
				src="/#{viewPath == null ? 'jsf' : viewPath}/#{currentTree.viewPath}#{currentTree.type}/ViewPanel.xhtml">
				<ui:param name="editor" value="#{currentTree.editor}"/>
				<ui:param name="entity" value="#{currentTree.instance}"/>
				<ui:param name="label" value="#{messages['General']}"/>
			</ui:include>
		</h:panelGrid>
	</ui:define>
	
	<ui:define name="folders">
		<c:forEach items="#{currentTree.childList}" var="folder">
			<rich:spacer rendered="#{folder.rendered}" width="1" height="5"/>
			<tt:toggle-panel
				id="#{folder.id}TP"
				label="#{folder.text} (#{folder.childCount})"
				rendered="#{folder.rendered}"
				switchType="#{folder.ajaxMode}"
				opened="#{folder.opened}">
				
				<a4j:support event="onexpand" actionListener="#{folder.expandListener}" eventsQueue="viewQ" />
				<a4j:support event="oncollapse" actionListener="#{folder.collapseListener}" eventsQueue="viewQ" />
				
				<ui:include src="#{folder.viewPanel}">
					<ui:param name="id" value="#{folder.id}"/>
				</ui:include>
				
			</tt:toggle-panel>
		</c:forEach>
	</ui:define>
	
</ui:composition>